/*----------------------------------------------------------------------------
Owner(s): Shane Whitfield
$Copyright: $
$Id: 

Purpose  : Data for supply line
----------------------------------------------------------------------------*/

#pragma once

#include "go.h"
#include "texture.h"
#include <string>

/*--------------------------------------------------------------------------*/
// Forward Declarations
class CGoPath;

/*--------------------------------------------------------------------------*/
//  Class CFollowState declaration.
class CFollowState
{
public:

	const Vector2f& GetPos() const {
			return m_pos; }

	const Vector2f&	GetLastPos() const {
			return m_lastPos;	}

	float			GetDistTraveled() const {
						return m_distTraveled; }
						
private:

	int			m_curSeg;			// the current segment the state is on
	Vector2f	m_lastPos;			// where was the state last
	float		m_distTraveled;		// sum of all distance travelled along the spline
	Vector2f	m_pos;				// where is the state now

	friend class CGoPath;
};

/*--------------------------------------------------------------------------*/
//  Class CGoPath declaration.
class CGoPath : public CGo
{
	typedef CGo super;

public:
	
					CGoPath();
	
	//CGo Overrides
	virtual EClass	GetClass() {
						return EClass_Path;}
	virtual void	Render();
	
	void			Init(CFollowState& outFollowState ) const;
	bool			Advance(CFollowState& io_followState, float i_distanceToTravel) const;
	void			AddPathPoint(const Vector2f& i_pos);
	void			SetName(const char* i_name) {
						m_name = i_name; }
	const char*		GetName() const {
						return m_name.c_str(); }
	
private:

	std::vector<Vector2f>	m_travelPoints;			// all the points to travel when on the supply line
	std::vector<float>		m_distances;			// the distances from the start to this point (if traveling along the line)
	float					m_length;				// total length of the path
	std::string				m_name;					//$$$ BB (SAW) Later we might want to optimize names for all gos.
	static const CTexture*	m_connectionTexture;	// texture for supply line
	
};

/*-----------------------------------EOF!-----------------------------------*/
